<?php

namespace App\Http\Requests\User;


class GoodsRequest extends FormRequest
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'goods_name'    =>  'required',
            'price'         =>  'required|digits_between:1,9000000',
            'goods_code'    =>  'required|unique:goods,goods_code',
            //
        ];
    }


    public function messages()
    {
        return [
            'goods_name.required'   =>  '商品名不可以空',
            'price.required'        =>  '商品价格不可以空',
            'price.digits_between'  =>  '商品价格必须正数',
            'goods_code.required'   =>  '商品CODE不可以空',
            'goods_code.unique'     =>  '商品CODE已存在',
        ];
    }
}
